package com.gjy.scala.funtion

object FlatMapUsage {
  def main(args: Array[String]): Unit = {
    val sentence = List("apple banana cherry date elderberry")
    val wordLength = sentence.flatMap(line => line.split(" "))
    println(wordLength)

    val sentence2 = List("apple,banana,cherry,date,elderberry")
    val wordLength2 = sentence2.flatMap(line => line.split(","))
    println(wordLength2)

    println(wordLength.equals(wordLength2))
    println(sentence.equals(sentence2))
    println(wordLength.eq(wordLength2))

  }
}
